var Li = document.getElementsByClassName('entire--content-all')
var arr = [].slice.call(Li)
var del = document.getElementsByClassName('entire--content--delete');
var arrs = [].slice.call(del)
arrs.forEach(function (v, k) {
    arr.forEach(function (n, m) {
        v.addEventListener('click', function (e) {
            if (m === k) {
                n.style.opacity = 0;
                setTimeout(function () {
                    n.style.display = 'none'
                }, 600)
            }
        })
    })
})

var _domA = Array.prototype.slice.call( document.getElementsByClassName('entire--content-all'));
var _dom = Array.prototype.slice.call(document.getElementsByClassName('entire--content'));
var startx,starty;
function getAngle(angx,angy) {
    return Math.atan(angy,angx) * 180/Math.PI;
};
function getDirection(startx, starty, endx, endy) {
    var angx = endx - startx;
    var angy = endy - starty;
    var result = 0;
    var angle = getAngle(angx, angy);
    if (angle >= -135 && angle <= -45) {
        result = 1;
    } else if ((angle >= -45 && angle <= 45)) {
        result = 2;
    }
    return result;
}
_domA.forEach(function (v) {
    v.addEventListener("touchstart",function (e) {
        startx = e.touches[0].pageX;
        starty = e.touches[0].pageY;
    },false);
    v.addEventListener("touchmove",function (e) {
        document.getElementsByClassName('entire--content-all')[0].style.left = 0;
        document.getElementsByClassName('entire--content-all')[1].style.left = 0;
        document.getElementsByClassName('entire--content-all')[2].style.left = 0;
        document.getElementsByClassName('entire--content-all')[3].style.left = 0;
        document.getElementsByClassName('entire--content-all')[4].style.left = 0;
        document.getElementsByClassName('entire--content-all')[5].style.left = 0;
        var endx, endy;
        endx = e.changedTouches[0].pageX;
        endy = e.changedTouches[0].pageY;
        var direction = getDirection(startx, starty, endx, endy);
        switch (direction){
            case 1:
                v.style.left = -78 + 'px';
                break;
            case 2:
                _dom.style.top = 78 + 'px';
                break;
            default:
        }
    })
},false);